<%-- 
    Document   : newTicket
    
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
 <%@page import="cs425proj.model.*" %>
<!DOCTYPE html>

        <%String name = (String) session.getAttribute("name");%>
         
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Purchase Ticket</title>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
         <script >
                    function calPrice() {
                             
                       document.getElementById('kimat').innerHTML= (document.getElementById('seats').value)*12; 
                      }</script>
         <script language="javascript" type="text/javascript" src="datetimepicker.js"></script>
    </head>
    <body>
        <table align="center">
            <thead>
                <tr>
                    <th><h1>CS 425 Project </h1></th>
                </tr>
            </thead>
        </table>
        <form name="purchase" action="PurchaseTicket" method=get>
            <div>
                <table cellpadding=4 cellspacing=2 border=0 align="center" width="400" >
                <th bgcolor="#efefef" colspan=2>
                <font size=5>Ticket Booking</font>
                <br><font size=1><sup></sup></font><hr>
                </th>
                <tr bgcolor="#efefef"><td valign=top> 
                <b>Location</b> 
                <br><input type="text" name="location" value="<%=request.getParameter("country")%>" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Movie</b>
                    <br><input type="text" name="movie" value="<%=request.getParameter("state")%>" size=15 maxlength=20>
                </td>
                </tr>
                <tr bgcolor="#efefef">
                <td valign=top><b>Date</b> 
                <br><input type="text" name="date" value="<%=request.getParameter("city")%>" size=25 
                maxlength=125><br></td><td valign=top>
                <b>Theater</b> <br>
                <input type="text" name="theater" value="<%=request.getParameter("theater")%>" size=15 maxlength=11></td>
                </tr>
                <tr bgcolor="#efefef"><td valign=top colspan=2>
                <b>Show Time</b><br>
                <input type="text" name="showtime" size=25 value="<%=request.getParameter("showtime")%>" maxlength=10>
                </td></tr>
                <tr bgcolor="#efefef">
                <td valign=top><b>Seats</b> 
                <br>
               
                
                <select name='seat' id="seats" onchange="calPrice()">
                        <option value="none">Select</option>  
                        
                        <option value="1">1</option>  
                        
                        <option value="2">2</option>  
                        
                        <option value="3">3</option>  
                        
                        <option value="4">4</option>  
                        <option value="5">5</option>  
                        
                        <option value="6">6</option>  
                        
                        <option value="7">7</option>  
                        
                        <option value="8">8</option>  
                        <option value="9">9</option>  
                        
                        <option value="10">10</option>  
                        
                        
                        
                        </select>  
                
                </td><td valign=top>
                <b>Price $</b>
                <br>
                <div id="kimat">
                    <input  type="text" name="price" size=10 value="" maxlength=10>
                </div>
                </td><br>
                </tr>
                
                 <%if(null== name ){%>
                 
                <tr bgcolor="#efefef"><td valign=top> 
                <b>First Name</b> 
                <br><input type="text" name="f_name" value="" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Last Name</b>
                    <br><input type="text" name="l_name" value="" size=15 maxlength=20>
                    
                </td>
                </tr>
                                  <tr bgcolor="#efefef"><td valign=top> 
                <b>Phone</b> 
                <br><input type="text" name="phone" value="" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Email</b>
                    <br><input type="text" name="email" value="" size=15 maxlength=20>
                </td>
                </tr>
                <%}else{
                 MemberDetail mdobj = new MemberDetail();
                 mdobj.selectMemberData(name);
                %>
                
                <tr bgcolor="#efefef"><td valign=top> 
                <b>First Name</b> 
                <br><input type="text" name="f_name" value="<%=mdobj.getF_name()%>" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Last Name</b>
                    <br><input type="text" name="l_name" value="<%=mdobj.getL_name()%>" size=15 maxlength=20>
                    
                </td>
                </tr>
                                  <tr bgcolor="#efefef"><td valign=top> 
                <b>Phone</b> 
                <br><input type="text" name="phone" value="<%=mdobj.getPhone()%>" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Email</b>
                    <br><input type="text" name="email" value="<%=mdobj.getEmail()%>" size=15 maxlength=20>
                </td>
                </tr>
                <%}%>
                <tr bgcolor="#efefef"><td valign=top> 
                <b>Credit Card Number</b> 
                <br><input type="text" name="creditcard_number" value="" size=25 maxlength=20>
                
                </td>
                <td valign=top><b>Credit Card Type</b>
                    <br><input type="text" name="cc_type" value="" size=15 maxlength=20>
                </td>
                </tr>
                <tr bgcolor="#efefef"><td valign=top> 
                <b>Expiry Date</b> 
                <br><input id ="demo1" type="text" name="expire_date" value="" size=25 maxlength=20>
                <a href="javascript:NewCal('demo1','mmmddyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
                </td>
                <td valign=top><b>CVV </b>
                    <br><input type="text" name="cvv_number" value="" size=15 maxlength=20>
                </td>
                </tr>
                    
                <tr bgcolor="#efefef">
                <td align=center colspan=2><hr>
                <input type="submit" value="Purchase"></td></tr></table></center>
            </div>
        </form>
               
                

    </body>
</html>
